package action.RDD基本转换操作4

import org.apache.spark.{SparkConf, SparkContext}

/**
  * def union(other: RDD[T]): RDD[T]
  *
  * 该函数比较简单，就是将两个RDD进行合并，<b>不去重</b>。
  *
  * @author wdmcode@aliyun.com
  * @version 1.0.0
  * @date 2018/11/8
  */
object SparkUnion {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
    conf.setAppName("SparkParallelize")
    conf.setMaster("local[2]")

    val spark = new SparkContext(conf)

    val rdd = spark.parallelize(1 to 2)

    val rdd2 = spark.parallelize(2 to 3)

    val rddUnion = rdd.union(rdd2)

    // rddUnion: Array[Int] = Array(1, 2, 2, 3)
  }
}
